package com.tedu.demo1;

import com.mysql.cj.jdbc.Driver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Author：毕龙
 * Date: 2024/6/14 9:24
 */
public class TestJdbc {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //获取驱动Driver
        Class.forName("com.mysql.cj.jdbc.Driver");
        //获取链接
        String url = "jdbc:mysql://localhost:3306/db1?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Chongqing";
        String username = "root";
        String password = "root";
        Connection connection = DriverManager.getConnection(url,username,password );
        System.out.println("connection:"+connection);


    }
}
